import pymongo


client = pymongo.MongoClient('localhost', 27017)
print(client.list_database_names())

# 不存在自动创建
collection = client['stu']['info']

# kunInfo = {'_id':1,'name':'徐坤','age':25}
#
# collection.insert_one(kunInfo)


# info_lis = [{'_id':2,'name':'老大','age':42}, {'_id':3,'name':'听泉','age':27}]
#
# collection.insert_many(info_lis)


res = collection.find()
for i in res:
    print(i)